package com.boot.project.core.model.system.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.boot.project.core.model.base.BaseEntity;
import com.boot.project.core.model.system.dto.UserSaveDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

/**
 * @description:
 * @author: tsing
 * @create: 2021-01-22 22:38
 */
@TableName("sys_user")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User extends BaseEntity {

    private String username; // 用户名
    @JsonIgnore
    private String password; // 密码
    private String mobile; // 手机号码

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long roleId; // 角色

    public User(UserSaveDto dto) {
        BeanUtils.copyProperties(dto, this);
    }
}
